package com.gitease.quickhub.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.OffsetDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class RepositoryDTO {
  private Long id;
  private String name;

  @JsonProperty("full_name")
  private String fullName;

  @JsonProperty("human_name")
  private String humanName;

  private String description;

  @JsonProperty("html_url")
  private String htmlUrl;

  @JsonProperty("ssh_url")
  private String sshUrl;

  @JsonProperty("clone_url")
  private String cloneUrl;

  @JsonProperty("default_branch")
  private String defaultBranch;

  @JsonProperty("private")
  private boolean isPrivate;

  private boolean fork;

  @JsonProperty("stargazers_count")
  private int stargazersCount;

  @JsonProperty("watchers_count")
  private int watchersCount;

  @JsonProperty("forks_count")
  private int forksCount;

  @JsonProperty("open_issues_count")
  private int openIssuesCount;

  @JsonProperty("created_at")
  private OffsetDateTime createdAt;

  @JsonProperty("updated_at")
  private OffsetDateTime updatedAt;

  @JsonProperty("pushed_at")
  private OffsetDateTime pushedAt;

  private Owner owner;

  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  @JsonIgnoreProperties(ignoreUnknown = true)
  public static class Owner {
    private Long id;
    private String login;
    private String name;

    @JsonProperty("avatar_url")
    private String avatarUrl;
  }
}